草庐IT

python - Matplotlib 无法抑制图形窗口

全部标签

go - 无法使用远程 api 从 go 连接到谷歌云数据存储

我使用以下go代码(大部分借自go_appengine/demos/remote_api/datastore_info.go):packagemainimport("net/http""net/http/cookiejar""net/url""regexp""io/ioutil""log""errors"//"appengine""appengine/remote_api""appengine/datastore""fmt")typeCustomTypestruct{FirstNamestringLastNamestring}funcclientLoginClient(host,ema

html - XMLHttpRequest 无法加载 http ://localhost:9090/receive. 请求的资源上不存在 'Access-Control-Allow-Origin' header

我通过nginx服务器打开一个html文件,然后html文件将“POST”请求从dropzone传递到nginx服务器,然后proxy_pass到我的go服务器。然后这个go服务器接受请求。但是当我尝试使用我的html文件并在拖放区中放置一些东西时,我得到了错误:XMLHttpRequestcannotloadhttp://localhost:9090/receive.No'Access-Control-Allow-Origin'headerispresentontherequestedresource.Origin'http://localhost:9009'isthereforen

mongodb - 无法使用 golang 将结构保存到 mongodb 中(仅创建空记录)

我有以下结构typeResultstruct{nidstringtimestampint64hexhashstringaddrstring}我想保存到mongodb中:我创造了它r:=Result{hex_id,int64(msg.timestamp.Unix()),hexhash,msg.addr.String()}并测试是否正确创建:fmt.Println(r)这给了我预期的结果:{b8da3f19d1318af6879976c1eea66c78c48e1144142141725265072917F19D7F4C4B54C9C66A3EB31F77012981127.0.0.1:6

python - 解析 docopt 参数类型(任何语言)

我有一个用例,其中用户提供了一个docopt字符串,并基于它生成了一些代码。所以我不知道我的docopt字符串。对于某些“参数类型”(不是数据类型),我希望生成各种代码。在下文中,我将区分“类型”和“数据类型”。对于docopt参数--arg=DEGREES和argv输入--arg=10,--arg的“类型”是DEGREES,而数据类型是integer.值为10.用户可能会给我以下docopt字符串:NavalFate.Usage:naval_fate--dir=FILE[--speed=ABC]Options:--dir=FILEMoored(anchored)mine.--spee

go - 无法使用 Docker 容器自动运行简单的 Go Web 服务器(func (*Template) Execute)

所以我试图在CoreOS上的docker容器中自动运行一个简单的“helloworld”网络服务器。但是当应用程序尝试执行HTML模板时出现错误。这是有问题的代码:funcGateHandler(whttp.ResponseWriter,r*http.Request){fmt.Println("EnteredtheGateHandler.")t,_:=template.ParseFiles("templates/helloworld.html")fmt.Println("PassedtheParseFiles.")err:=t.Execute(w,nil)fmt.Println("Pa

go - 无法使用 golang 和 net/http 包分配请求的地址

我在golang中有这个服务器:packagemainimport("fmt""net/http")funchello(whttp.ResponseWriter,r*http.Request){w.WriteHeader(204)fmt.Fprintf(w,"Hithere,Ilove%s!",r.URL.Path[1:])w.Header().Set("Connection","close")fmt.Println(r.Close)}funcmain(){http.HandleFunc("/",hello)http.ListenAndServe(":8080",nil)}然后我想尝试

go - 无法在travis中构建go项目

我开始创建一个非常轻量级的消息代理来在一个项目中练习go、travis和一些aws服务。我当前的问题是我可以在我的本地机器上构建、运行和测试我的开发分支,但是当travis尝试构建它时我得到一个编译错误。它不喜欢的代码直接来自AWS示例,进一步加深了我的神秘感。Travis构建失败https://travis-ci.org/hevnly/eevy/builds/65687886Githubrepohttps://github.com/hevnly/eevy/tree/92412cf729ed546d698ded1e514d2d54c340ff81错误handler/lambda.go:

go - 无法检测到 go protobuf 的版本控制系统

在我的go项目上运行goget我收到以下错误消息:packagecode.google.com/p/goprotobuf/proto:无法检测code.google.com/路径的版本控制系统我什么都没有改变,这是怎么回事? 最佳答案 golangprotobuf项目已从googlecode移动至github.用于从ProtocolBuffer定义生成go代码的protoc版本已过时并使用旧导入。从github项目说明安装protoc-gen-go:https://github.com/golang/protobuf

go - 无法在 main 以外的包内调用测试

我正在为我的go代码和发件人文件夹内部编写测试,发件人包我添加了exposed_api_test.go(也尝试了exposed_api_test.go因为我有代码exposed_api.go)packagesenderimport("log""testing""github.com/stretchr/testify/assert")funcTestTimeConsuming(t*testing.T){assert.Equal(t,"test","test1")}当我运行构建并运行命令gotestmy_project我得到?my_project[无测试文件]当我将测试从这个包中取出时(在

mongodb - 当键包含大写字母时无法使用 mgo 检索值

来自mongoDB的一个数据是{"_id":ObjectId("5536def4e4b0644323e219a8"),"title":"TheTitle","description":"TheDescription","timeStamp":"21/04/2015","category":"news","url":"http://www.example.com","source":"EveningTimes","mainStory":"Thisisthemainstory."}在我的代码中,结构是typeNewsDatastruct{Titlestring`bson:"title"js